package com.uzai.console.service.locallive.impl;

import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import com.uzai.common.enums.OrderReStatusEnum;
import com.uzai.common.enums.OrderStatusEnum;
import com.uzai.common.exception.BusinessException;
import com.uzai.console.common.UzaiRespVo;
import com.uzai.console.common.utils.DateUtil;
import com.uzai.console.common.utils.Tools;
import com.uzai.console.dto.feign.tborder.TbOrderPullDto;
import com.uzai.console.dto.feign.tlbelm.TlbElmOrderPullDto;
import com.uzai.console.dto.feign.tlbelm.TlbElmOrderSettledDto;
import com.uzai.console.dto.locallive.elmorder.ElmFindUnReceicedDto;
import com.uzai.console.dto.locallive.elmorder.ElmOrderDownLoadDto;
import com.uzai.console.dto.locallive.mtorder.MtFindUnReceicedDto;
import com.uzai.console.entity.ElmOrder;
import com.uzai.console.entity.MtOrder;
import com.uzai.console.entity.TbToken;
import com.uzai.console.mapper.ElmOrderMapper;
import com.uzai.console.mapper.TbTokenMapper;
import com.uzai.console.para.TbOrderRemoteApiPara;
import com.uzai.console.service.feign.TbOrderFeignService;
import com.uzai.console.service.feign.TlbElmOrderFeignService;
import com.uzai.console.service.locallive.ElmOrderSyncService;
import com.uzai.console.service.remoteapi.TbOrderRemoteApiService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Auther: jianghan
 * @Date: 2019/11/27 11:23
 * @Description:
 */
@Service
public class ElmOrderSyncServiceImpl implements ElmOrderSyncService {

    private static Logger logger = LoggerFactory.getLogger(ElmOrderSyncServiceImpl.class);

    @Autowired
    private TbTokenMapper tbTokenMapper;
    @Autowired
    private ElmOrderMapper elmOrderMapper;
    @Autowired
    private TbOrderRemoteApiService tbOrderRemoteApiService;
    @Autowired
    private TlbElmOrderFeignService tlbElmOrderFeignService;

    /**
     * 手动下载单个饿了么联盟订单
     * @author liuqi
     * @date 2021/8/13 11:38
     * @param elmOrderDownLoadDto
     * @return null
     */
    @Override
    public void downloadOrder(ElmOrderDownLoadDto elmOrderDownLoadDto, Long tbTokenId) {

        //调用订单业务库服务器
//        TbToken tbToken = tbTokenMapper.selectById(tbTokenId, elmOrderDownLoadDto.getMerId());
//        if (tbToken != null) {
//            try{
//                TbOrderPullDto tbOrderPullDto = new TbOrderPullDto();
//                tbOrderPullDto.setTokenId(String.valueOf(tbToken.getUserId()));
//                tbOrderPullDto.setPlatform("tb");
//                tbOrderPullDto.setStartTime(elmOrderDownLoadDto.getQueryStartTime());
//                tbOrderPullDto.setEndTime(elmOrderDownLoadDto.getQueryEndTime());
//                tbOrderPullDto.setTimeType(elmOrderDownLoadDto.getQueryTimeType());
//                //请求订单拉取接口
//                tbOrderFeignService.pull(tbOrderPullDto);
//            }catch (Exception e){
//                logger.error(e.getMessage());
//            }
//        }

        //调用订单拉取库服务器
        //判断是否到期,未到期才调用订单拉取库服务器拉取订单
//        if(tbToken != null) {
//            //判断联盟是否到期
//            if (Tools.getInteger(tbToken.getExptime()).intValue() > DateUtil.getNowTime()) {
//                if (elmOrderDownLoadDto.getOrderScene().intValue() != 4) { //不是维权订单
//                    TbOrderRemoteApiPara tbOrderRemoteApiPara = new TbOrderRemoteApiPara();
//                    tbOrderRemoteApiPara.setAccessToken(tbToken.getAccessToken());
//                    tbOrderRemoteApiPara.setUserId(tbToken.getUserId());
//                    tbOrderRemoteApiPara.setUserName(tbToken.getUserName());
//                    tbOrderRemoteApiPara.setQueryTimeType(elmOrderDownLoadDto.getQueryTimeType());
//                    tbOrderRemoteApiPara.setQueryStartTime(elmOrderDownLoadDto.getQueryStartTime());
//                    tbOrderRemoteApiPara.setQueryEndTime(elmOrderDownLoadDto.getQueryEndTime());
//                    tbOrderRemoteApiPara.setOrderScene(elmOrderDownLoadDto.getOrderScene());
//                    tbOrderRemoteApiService.remoteDownload(tbOrderRemoteApiPara);
//                } else { //维权订单
//                    TbOrderRemoteApiPara tbOrderRemoteApiPara = new TbOrderRemoteApiPara();
//                    tbOrderRemoteApiPara.setAccessToken(tbToken.getAccessToken());
//                    tbOrderRemoteApiPara.setUserId(tbToken.getUserId());
//                    tbOrderRemoteApiPara.setUserName(tbToken.getUserName());
//                    tbOrderRemoteApiPara.setQueryTimeType(elmOrderDownLoadDto.getQueryTimeType());
//                    tbOrderRemoteApiPara.setQueryStartTime(elmOrderDownLoadDto.getQueryStartTime());
//                    tbOrderRemoteApiPara.setQueryEndTime(elmOrderDownLoadDto.getQueryEndTime());
//                    tbOrderRemoteApiPara.setOrderScene(elmOrderDownLoadDto.getOrderScene());
//                    tbOrderRemoteApiService.remoteDownloadRefund(tbOrderRemoteApiPara);
//                }
//            }
//        }

        //modify 20230328 饿了么订单直接在推老板下载
        TlbElmOrderPullDto tlbElmOrderPullDto = new TlbElmOrderPullDto();
        tlbElmOrderPullDto.setTimeType(elmOrderDownLoadDto.getQueryTimeType());
        tlbElmOrderPullDto.setBeginTime(elmOrderDownLoadDto.getQueryStartTime());
        tlbElmOrderPullDto.setEndTime(elmOrderDownLoadDto.getQueryEndTime());
        UzaiRespVo<Object> uzaiRespVo_download = tlbElmOrderFeignService.download(tlbElmOrderPullDto);
        logger.info("---饿了么订单推老板平台下载---para={}, result={}", JSONObject.toJSONString(tlbElmOrderPullDto), JSONObject.toJSONString(uzaiRespVo_download));

    }

    /**
     * 异步手动下载多个饿了么联盟订单
     * @author liuqi
     * @date 2021/8/13 11:38
     * @param elmOrderDownLoadDto
     * @return null
     */
    @Async("taskExecutor")
    @Override
    public void downloadOrderListSync(ElmOrderDownLoadDto elmOrderDownLoadDto) {
//        if(elmOrderDownLoadDto.getIdList() != null && elmOrderDownLoadDto.getIdList().size() > 0){
//            for (Long id : elmOrderDownLoadDto.getIdList()){
//                try {
//                    downloadOrder(elmOrderDownLoadDto, id);
//                }catch (Exception e){
//                    logger.error("-------downloadOrderListSync is error elmTokenId={}, error={}", id, e.getMessage());
//                }
//            }
//        }

        downloadOrder(elmOrderDownLoadDto, null);

    }

    /**
     * 远程调用订单库API，手动更新单个订单
     * @author liuqi
     * @date 2021/8/13 11:38
     * @param elmOrder
     * @return null
     */
    @Override
    public void updateElmOrder(ElmOrder elmOrder) {
        //判断订单存在或者已删除
        if(elmOrder == null ){
            return;
        }

        //modify 20230328 饿了么订单直接在推老板刷新
        TlbElmOrderPullDto tlbElmOrderPullDto = new TlbElmOrderPullDto();
        tlbElmOrderPullDto.setParentOrderNo(elmOrder.getParentOrderNo());
        UzaiRespVo<Object> uzaiRespVo_update = tlbElmOrderFeignService.getOrderByOrderid(tlbElmOrderPullDto);
        logger.info("---饿了么订单根据父订单号更新---para={}, result={}", JSONObject.toJSONString(tlbElmOrderPullDto), JSONObject.toJSONString(uzaiRespVo_update));

    }

    /**
     * 远程调用订单库API，更新7天前未收货订单
     * @author liuqi
     * @date 2021/8/13 11:38
     * @param merId
     * @return null
     */
    @Async("taskExecutor")
    @Override
    public void updateElmOrderUnReceivedListSync(Long merId) {

        //查询7天前未收货订单
        ElmFindUnReceicedDto elmFindUnReceicedDto = new ElmFindUnReceicedDto();
        elmFindUnReceicedDto.setMerId(merId);
        //设置开始时间未90天前
        Integer now = DateUtil.getNowTime();
        elmFindUnReceicedDto.setQueryStartTime(now - 7776000);
        //设置结束时间为7天前
        elmFindUnReceicedDto.setQueryEndTime(now-604800);
        //查询付款状态订单（未收货）
        elmFindUnReceicedDto.setStatus(0);

        List<ElmOrder> elmOrderList =  elmOrderMapper.findUnReceivedList(elmFindUnReceicedDto);
        if(elmOrderList != null){
            for (ElmOrder elmOrder : elmOrderList){
                try {
                    updateElmOrder(elmOrder);
                }catch (Exception e){
                    logger.error("-------updateElmOrderUnReceivedList is error ordersn={}, error={}", elmOrder.getParentOrderNo(),e.getMessage());
                    continue;
                }
            }
        }
    }

    @Override
    public void uploadElmOrderSettingSync(Long merId, int day, int status, List<Integer> sourceStatus) {
        if (merId == null) {
            return;
        }
        //设置结束时间为day天前
        int endTime = DateUtil.getNowTime() - day * 24 * 3600;
        elmOrderMapper.updateStatusPayCompleteToSettle(null, endTime, null, merId, status, sourceStatus);
    }

    /**
     * 远程调用订单库API，更新day天前未收货订单
     * @author liuqi
     * @date 2021/8/13 11:38
     * @param merId
     * @param day
     * @return null
     */
    @Override
    public void updateElmOrderUnReceivedListSync(Long merId, int day) {
        if(merId == null){
            return;
        }
        //查询7天前未收货订单
        ElmFindUnReceicedDto elmFindUnReceicedDto = new ElmFindUnReceicedDto();
        elmFindUnReceicedDto.setMerId(merId);
        //设置开始时间未90天前
        Integer now = DateUtil.getNowTime();
        elmFindUnReceicedDto.setQueryStartTime(now - 7776000);
        //设置结束时间为day天前
        int endTime = day * 24 * 3600;
        elmFindUnReceicedDto.setQueryEndTime(now - endTime);
        //查询付款状态订单（未收货）
        elmFindUnReceicedDto.setStatus(0);
        List<ElmOrder> elmOrderList =  elmOrderMapper.findUnReceivedList(elmFindUnReceicedDto);
        if(elmOrderList != null){
            for (ElmOrder elmOrder : elmOrderList){
                try {
                    updateElmOrder(elmOrder);
                }catch (Exception e){
                    logger.error("-------updateElmOrderUnReceivedListSync is error ordersn={}, error={}", elmOrder.getParentOrderNo(),e.getMessage());
                    continue;
                }
            }
        }
    }

    /**
     * 远程调用订单库API，更新day天前已冻结的订单
     * @author liuqi
     * @date 2021/8/13 11:38
     * @param merId
     * @param day
     * @return null
     */
    @Override
    public void updateElmOrderFreezedListSync(Long merId, int day) {
        if(merId == null){
            return;
        }
        //查询7天前未收货订单
        ElmFindUnReceicedDto elmFindUnReceicedDto = new ElmFindUnReceicedDto();
        elmFindUnReceicedDto.setMerId(merId);
        //设置开始时间未90天前
        Integer now = DateUtil.getNowTime();
        elmFindUnReceicedDto.setQueryStartTime(now - 7776000);
        //设置结束时间为day天前
        int endTime = day * 24 * 3600;
        elmFindUnReceicedDto.setQueryEndTime(now - endTime);
        //查询付款状态订单（已收货）
        elmFindUnReceicedDto.setStatus(1);
        List<ElmOrder> elmOrderList =  elmOrderMapper.findFreezedList(elmFindUnReceicedDto);
        if(elmOrderList != null){
            for (ElmOrder elmOrder : elmOrderList){
                try {
                    updateElmOrder(elmOrder);
                }catch (Exception e){
                    logger.error("-------updateElmOrderFreezedListSync is error ordersn={}, error={}", elmOrder.getParentOrderNo(),e.getMessage());
                    continue;
                }
            }
        }
    }

    /**
     * 远程调用订单库API，更新day天前未收货订单
     * @author liuqi
     * @date 2021/8/13 11:38
     * @param merId
     * @param startTime
     * @return null
     */
    @Override
    public void updateElmOrderUnReceivedListSync(Long merId, Integer startTime, Integer endTime, Long userId) {
        if(merId == null){
            return;
        }
        //查询7天前未收货订单
        ElmFindUnReceicedDto elmFindUnReceicedDto = new ElmFindUnReceicedDto();
        elmFindUnReceicedDto.setMerId(merId);
        elmFindUnReceicedDto.setQueryStartTime(startTime);
        elmFindUnReceicedDto.setQueryEndTime(endTime);
        elmFindUnReceicedDto.setUserId(userId);
        //查询付款状态订单（未收货）
        elmFindUnReceicedDto.setStatus(0);
        List<ElmOrder> elmOrderList =  elmOrderMapper.findUnReceivedList(elmFindUnReceicedDto);
        if(elmOrderList != null){
            for (ElmOrder elmOrder : elmOrderList){
                try {
                    updateElmOrder(elmOrder);
                }catch (Exception e){
                    logger.error("-------updateElmOrderUnReceivedListSync is error ordersn={}, error={}", elmOrder.getParentOrderNo(),e.getMessage());
                    continue;
                }
            }
        }
    }

    /**
     * 远程调用订单库API，更新day天前未收货订单
     * @author liuqi
     * @date 2021/8/13 11:38
     * @param merId
     * @param startTime
     * @return null
     */
    @Override
    public void updateElmOrderUnReceivedListSync_settle(Long merId, Integer startTime, Integer endTime, Long userId) {
        if(merId == null){
            return;
        }
        //查询7天前未收货订单
        ElmFindUnReceicedDto elmFindUnReceicedDto = new ElmFindUnReceicedDto();
        elmFindUnReceicedDto.setMerId(merId);
        elmFindUnReceicedDto.setQueryStartTime(startTime);
        elmFindUnReceicedDto.setQueryEndTime(endTime);
        elmFindUnReceicedDto.setUserId(userId);
        //查询付款状态订单（未收货）
        elmFindUnReceicedDto.setStatus(0);
        List<ElmOrder> elmOrderList =  elmOrderMapper.findUnReceivedList(elmFindUnReceicedDto);
        if(elmOrderList != null){
            for (ElmOrder elmOrder : elmOrderList){
                try {
                    //订单状态为0-付款状态时，才能确认收货
                    if(elmOrder.getStatus() == 0){
                        //调用确认收货接口
                        TlbElmOrderSettledDto tlbElmOrderSettledDto = new TlbElmOrderSettledDto();
                        tlbElmOrderSettledDto.setMerId(elmOrder.getMerId());
                        tlbElmOrderSettledDto.setOrderId(elmOrder.getParentOrderNo());
                        tlbElmOrderSettledDto.setChildOrderId(elmOrder.getChildOrderNo());
                        UzaiRespVo<Object> result =  tlbElmOrderFeignService.settled(tlbElmOrderSettledDto);
                        logger.info("---发送修改推老板饿了么订单确认收货-para={}, result={}", JSONObject.toJSONString(tlbElmOrderSettledDto), JSONObject.toJSONString(result));
                    }
                }catch (Exception e){
                    logger.error("-------updateElmOrderUnReceivedListSync_settle is error ordersn={}, error={}", elmOrder.getParentOrderNo(),e.getMessage());
                    continue;
                }
            }
        }
    }

    /**
     * 远程调用订单库API，更新day天前已冻结的订单
     * @author liuqi
     * @date 2021/8/13 11:38
     * @param merId
     * @param startTime
     * @return null
     */
    @Override
    public void updateElmOrderFreezedListSync(Long merId, Integer startTime, Integer endTime, Long userId) {
        if(merId == null){
            return;
        }
        //查询7天前未收货订单
        ElmFindUnReceicedDto elmFindUnReceicedDto = new ElmFindUnReceicedDto();
        elmFindUnReceicedDto.setMerId(merId);
        elmFindUnReceicedDto.setQueryStartTime(startTime);
        elmFindUnReceicedDto.setQueryEndTime(endTime);
        elmFindUnReceicedDto.setUserId(userId);
        //查询付款状态订单（已收货）
        elmFindUnReceicedDto.setStatus(1);
        List<ElmOrder> elmOrderList =  elmOrderMapper.findFreezedList(elmFindUnReceicedDto);
        if(elmOrderList != null){
            for (ElmOrder elmOrder : elmOrderList){
                try {
                    updateElmOrder(elmOrder);
                }catch (Exception e){
                    logger.error("-------updateElmOrderFreezedListSync is error ordersn={}, error={}", elmOrder.getParentOrderNo(),e.getMessage());
                    continue;
                }
            }
        }
    }

    /**
     * 远程调用订单库API，更新day天前已冻结订单
     * @author liuqi
     * @date 2021/8/13 11:38
     * @param merId
     * @param startTime
     * @return null
     */
    @Override
    public void updateElmOrderFreezedListSync_settle(Long merId, Integer startTime, Integer endTime, Long userId) {
        if(merId == null){
            return;
        }
        //查询7天前未收货订单
        ElmFindUnReceicedDto elmFindUnReceicedDto = new ElmFindUnReceicedDto();
        elmFindUnReceicedDto.setMerId(merId);
        elmFindUnReceicedDto.setQueryStartTime(startTime);
        elmFindUnReceicedDto.setQueryEndTime(endTime);
        elmFindUnReceicedDto.setUserId(userId);
        //查询付款状态订单（已收货）
        elmFindUnReceicedDto.setStatus(1);
        List<ElmOrder> elmOrderList =  elmOrderMapper.findFreezedList(elmFindUnReceicedDto);
        if(elmOrderList != null){
            for (ElmOrder elmOrder : elmOrderList){
                try {
                    //先修改订单状态为0-付款状态时，才能确认收货
                    elmOrder.setStatus(OrderStatusEnum.STATUS_PAID_VALUE);
                    elmOrder.setUpdateTime(DateUtil.getNowTime());
                    elmOrderMapper.updateStatus(elmOrder);
                    //调用确认收货接口
                    TlbElmOrderSettledDto tlbElmOrderSettledDto = new TlbElmOrderSettledDto();
                    tlbElmOrderSettledDto.setMerId(elmOrder.getMerId());
                    tlbElmOrderSettledDto.setOrderId(elmOrder.getParentOrderNo());
                    tlbElmOrderSettledDto.setChildOrderId(elmOrder.getChildOrderNo());
                    UzaiRespVo<Object> result =  tlbElmOrderFeignService.settled(tlbElmOrderSettledDto);
                    logger.info("---发送修改推老板饿了么订单确认收货-para={}, result={}", JSONObject.toJSONString(tlbElmOrderSettledDto), JSONObject.toJSONString(result));
                }catch (Exception e){
                    logger.error("-------updateElmOrderFreezedListSync_settle is error ordersn={}, error={}", elmOrder.getParentOrderNo(),e.getMessage());
                    continue;
                }
            }
        }
    }

    /**
     * 远程调用订单库API，更新day天前未收货订单
     * @author liuqi
     * @date 2021/8/13 11:38
     * @param merId
     * @param day
     * @return null
     */
    @Override
    public void updateElmOrderRefundingListSync(Long merId, int day) {
        if(merId == null){
            return;
        }
        //查询7天前未收货订单
        ElmFindUnReceicedDto elmFindUnReceicedDto = new ElmFindUnReceicedDto();
        elmFindUnReceicedDto.setMerId(merId);
        //设置开始时间未90天前
        Integer now = DateUtil.getNowTime();
        elmFindUnReceicedDto.setQueryStartTime(now - 7776000);
        //设置结束时间为day天前
        int endTime = day * 24 * 3600;
        elmFindUnReceicedDto.setQueryEndTime(now - endTime);
        //查询付款状态订单（未收货）
        elmFindUnReceicedDto.setStatus(OrderStatusEnum.STATUS_REFUNDING_VALUE);
        List<ElmOrder> elmOrderList =  elmOrderMapper.findUnReceivedList(elmFindUnReceicedDto);
        if(elmOrderList != null){
            for (ElmOrder elmOrder : elmOrderList){
                try {
                    updateElmOrder(elmOrder);
                }catch (Exception e){
                    logger.error("-------updateElmOrderRefundingListSync is error ordersn={}, error={}", elmOrder.getParentOrderNo(),e.getMessage());
                    continue;
                }
            }
        }
    }

    /**
     * 远程调用订单库API，更新day天前维权中的订单
     * @author liuqi
     * @date 2021/8/13 11:38
     * @param merId
     * @param startTime
     * @return null
     */
    @Override
    public void updateElmOrderRefundingListSync(Long merId, Integer startTime, Integer endTime, Long userId) {
        if(merId == null){
            return;
        }
        //查询7天前未收货订单
        ElmFindUnReceicedDto elmFindUnReceicedDto = new ElmFindUnReceicedDto();
        elmFindUnReceicedDto.setMerId(merId);
        elmFindUnReceicedDto.setQueryStartTime(startTime);
        elmFindUnReceicedDto.setQueryEndTime(endTime);
        elmFindUnReceicedDto.setUserId(userId);
        //查询维权中状态订单
        elmFindUnReceicedDto.setStatus(OrderStatusEnum.STATUS_REFUNDING_VALUE);
        List<ElmOrder> elmOrderList =  elmOrderMapper.findUnReceivedList(elmFindUnReceicedDto);
        if(elmOrderList != null){
            for (ElmOrder elmOrder : elmOrderList){
                try {
                    updateElmOrder(elmOrder);
                }catch (Exception e){
                    logger.error("-------updateElmOrderRefundingListSync is error ordersn={}, error={}", elmOrder.getParentOrderNo(),e.getMessage());
                    continue;
                }
            }
        }
    }

    /**
     * 远程调用订单库API，更新day天前维权中订单
     * @author liuqi
     * @date 2021/8/13 11:38
     * @param merId
     * @param startTime
     * @return null
     */
    @Override
    public void updateElmOrderRefundingListSync_settle(Long merId, Integer startTime, Integer endTime, Long userId) {
        if(merId == null){
            return;
        }
        //查询7天前未收货订单
        ElmFindUnReceicedDto elmFindUnReceicedDto = new ElmFindUnReceicedDto();
        elmFindUnReceicedDto.setMerId(merId);
        elmFindUnReceicedDto.setQueryStartTime(startTime);
        elmFindUnReceicedDto.setQueryEndTime(endTime);
        elmFindUnReceicedDto.setUserId(userId);
        //查询维权中状态订单
        elmFindUnReceicedDto.setStatus(OrderStatusEnum.STATUS_REFUNDING_VALUE);
        //根据订单返利状态查询
        elmFindUnReceicedDto.setReStatusList(Lists.newArrayList(OrderReStatusEnum.RE_STATUS_NO_VALUE, OrderReStatusEnum.RE_STATUS_FROZEN_VALUE));

        List<ElmOrder> elmOrderList =  elmOrderMapper.findUnReceivedList(elmFindUnReceicedDto);
        if(elmOrderList != null){
            for (ElmOrder elmOrder : elmOrderList){
                try {
                    //先修改订单状态为0-付款状态时，才能确认收货
                    elmOrder.setStatus(OrderStatusEnum.STATUS_PAID_VALUE);
                    elmOrder.setUpdateTime(DateUtil.getNowTime());
                    elmOrderMapper.updateStatus(elmOrder);
                    //调用确认收货接口
                    TlbElmOrderSettledDto tlbElmOrderSettledDto = new TlbElmOrderSettledDto();
                    tlbElmOrderSettledDto.setMerId(elmOrder.getMerId());
                    tlbElmOrderSettledDto.setOrderId(elmOrder.getParentOrderNo());
                    tlbElmOrderSettledDto.setChildOrderId(elmOrder.getChildOrderNo());
                    UzaiRespVo<Object> result =  tlbElmOrderFeignService.settled(tlbElmOrderSettledDto);
                    logger.info("---发送修改推老板饿了么订单确认收货-para={}, result={}", JSONObject.toJSONString(tlbElmOrderSettledDto), JSONObject.toJSONString(result));
                }catch (Exception e){
                    logger.error("-------updateElmOrderRefundingListSync_settle is error ordersn={}, error={}", elmOrder.getParentOrderNo(),e.getMessage());
                    continue;
                }
            }
        }
    }

}
